import requests
import json
from Read_conifg import ReadConfig
from Get_Token import Get_Token
from Get_Info import Get_Info

def Approval_Order(order_Num):
    url = ReadConfig().get_http("url_ysd")
    pharmacist_id = Get_Info().Get_pharmacist_id()
    Token = Get_Token().Get_Ysd_Token()
    headers={"Token":Token}
    body = {"orderNo": order_Num, "notes": "null", "result": "通过", "handler": pharmacist_id,
            "isMedIns": "false", "selfPrice": "null", "uid": pharmacist_id}
    res=requests.post(url=url+"YsMedOrder/approval",json=body,headers=headers)
    res_json=json.loads(res.text)
    if res_json['msg']=="成功":
        return order_Num
    else:
        try:
            return "审核订单失败，返回信息为："+res_json['msg']
        except:
            return "审核订单失败，返回状态码为："+res_json['code']
